<?php /* Template Name: Page With Sidebar */ ?>

<?php get_header(); ?>

		 <!-- Start Main Body -->
        <div class="main-container">
            <div class="main wrapper clearfix">

            	<!-- Start Main Content -->
                <div class="main-content">
                	<div class="clearfix">
                		
                         <!-- BEGIN LOOP -->
                       <?php while ( have_posts() ) : the_post(); ?>

                            <!-- FEATURED IMAGE -->
                            <?php
                                $featured_img_width = 741;
                                $post_thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full');
                                if ($post_thumbnail_src[1] < $featured_img_width) $featured_img_width = $post_thumbnail_src[1];


                                if (has_post_thumbnail(get_the_ID())) { 
                                    the_post_thumbnail(array($featured_img_width,9999));
                                }
                            ?>

                            <!-- THE TITLE -->  
                            <h1><?php the_title(); ?></h1>
                            
                            <!-- MAIN CONTENT AND WP_LINK_PAGES -->
                            <?php the_content(); ?>
                            <?php wp_link_pages(); ?>

                        <?php endwhile; ?>
                        <!-- END LOOP -->

					<!-- Finish Main Content -->
                	</div>    
                </div>
				
                <!-- SIDEBAR -->
                <?php 

                    if (class_exists('Woocommerce')) {
                        if (mb_is_woocommerce_page()) {
                            get_sidebar("woocommerce");
                        } else {
                            get_sidebar("page"); 
                        }
                            
                    } else {
                        get_sidebar("page"); 
                    }

                ?>


        	</div> <!-- #main -->
        </div> <!-- #main-container -->

<?php get_footer(); ?>
